<template>
	<view>
		<view></view>
		<view v-for="(item,index) in textArr" :key="index">
			{{item}}<button type="default" @click="fuzhi(item)">复制</button>
		</view>
		<view style="margin-top: 260rpx;">值：{{showtext}} <button type="default" @click="getText">粘贴</button> </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				textArr: ['123', '456', '789'],
				showtext: ''
			}
		},
		methods: {
			fuzhi(text) {
				uni.setClipboardData({
					data: text,
					success: function() {
						uni.hideToast()
					}
				})
			},
			getText() {
				let _this = this;
				uni.getClipboardData({
					success: function(res) {
						_this.showtext = res.data;
					}
				});
			}
		}
	}
</script>

<style scoped>

</style>
